package smartcase.config.access;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import smartcase.base.access.AccessInterceptor;

@Configuration
public class AccessConfigurationAdapter implements WebMvcConfigurer {

  private final AccessInterceptor accessInterceptor;

  public AccessConfigurationAdapter(AccessInterceptor accessInterceptor) {
    this.accessInterceptor = accessInterceptor;
  }

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(accessInterceptor).addPathPatterns("/**").order(0);
  }
}
